Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #22862 - change the httpclient user-agent to be valid spec-wise #22882

Merged
merged 1 commit into from Oct 29, 2023
Merged

Fix #22862 - change the httpclient user-agent to be valid spec-wise #22882

merged 1 commit into from Oct 29, 2023

Conversation

ghost
Copy link

@ghost ghost commented Oct 29, 2023

Per https://datatracker.ietf.org/doc/html/rfc9110#name-user-agent a User-Agent is defined as follows:

  User-Agent = product *( RWS ( product / comment ) )

Where

  product         = token ["/" product-version]
  product-version = token

In this case, token is defined in RFC 7230 - https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6:

     token          = 1*tchar

     tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
                    / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
                    / DIGIT / ALPHA
                    ; any VCHAR, except delimiters

or, in the original RFC 2616 - https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 (next page):

       token          = 1*<any CHAR except CTLs or separators>
       separators     = "(" | ")" | "<" | ">" | "@"
                      | "," | ";" | ":" | "\" | <">
                      | "/" | "[" | "]" | "?" | "="
                      | "{" | "}" | SP | HT

which means that a token cannot have whitespace. Not sure if this should be in the breaking changelog section - theoretically, some clients might've relied on the old Nim user-agent?

For some extra info, some other languages seem to have adopted the same hyphen user agent to specify the language + module, e.g.:

Fixes #22862.

@Araq Araq merged commit 94ffc18 into nim-lang:devel Oct 29, 2023
19 checks passed
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 94ffc18

Hint: mm: orc; opt: speed; options: -d:release
174726 lines; 10.521s; 770.207MiB peakmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot getContent with httpClient for specific website
1 participant